package exam.web.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.beanutils.BeanUtils;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import exam.common.util.ForwardResult;
import exam.db.dao.TUserDao;
import exam.db.entity.TUserEntity;
import exam.web.form.UserForm;

public class UserAction extends Action{
	public ActionForward execute(ActionMapping mapping,
			ActionForm form,
			HttpServletRequest request,
			HttpServletResponse response) throws Exception {
//		// retForward
//		String retForward = null;
//		// UserForm
//		UserForm userForm = (UserForm) form;
//		// TUserEntity
//		TUserEntity userEntity = new TUserEntity();
//		// userEntity = userForm
//		BeanUtils.copyProperties(userEntity, userForm);
//		// 
//		TUserDao tUserDao = new TUserDao();
//		if (tUserDao.insertByFile(userEntity) == 0) {
//			request.setAttribute("message", "Thêm mới người dùng thất bại!");
//			retForward = ForwardResult.FAILED;
//		} else {
//			request.setAttribute("message", "Thêm mới người dùng thành công!");
//			retForward = ForwardResult.SUCCESS;
//		}
		// return success
		return mapping.findForward(ForwardResult.SUCCESS);
	}
}
